﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<JLL.China.Model.Listings>" %>
<div class="wrapper">
    <div class="left">
    <table border="0" cellpadding="0" cellspacing="0" class="tbl-form" >
     <caption>Listing Information</caption>
     <tr>
     <th></th>
     <td><% if (this.Model != null)
                {
                    string checkedNewLaunch = "";
                    string checkedAction = "";
                    if (this.Model.NewLaunch!=null)
                    {
                        if (this.Model.NewLaunch.Value.ToString().Equals("True"))
                        {
                            checkedNewLaunch = "checked";
                        }
                    }
                    if (this.Model.Auction!=null)
                    {
                        if (this.Model.Auction.Value.ToString().Equals("True"))
                        {
                            checkedAction = "checked";
                        }
                    }
                   
                %>
            	 <span class="checkbox"><input type="checkbox" value="1" <%=checkedNewLaunch%>  name="NewLaunch" /> New Launch </span>
            <span class="checkbox"><input type="checkbox" <%=checkedAction%> value="1" name="Auction"/> Auction </span>
            <%}
                else
                { %>
                 <span class="checkbox"><input type="checkbox" value="1"  name="NewLaunch" /> New Launch </span>
            <span class="checkbox"><input type="checkbox"  value="1" name="Auction"/> Auction </span>
            <%} %></td>
     </tr>
    <tr>
        <th>
            <span class="mandate">*</span> <b>Project Name:</b>
        </th>
        <td>
          <% Html.RenderPartial("ProjectName",(this.Model==  null)? "":this.Model.ProjectNameFID.ToString()); %>
        
        </td>
        <td>
            </a>
            
        </td>
    </tr>
    <tr>
    <tr>
        <th><span class="mandate">*</span>Property For:</th>
        <td>
        
                            <% if (this.Model != null)
                               { %>
                            <input type="radio" name="PropertyFor" class="PropertyFor _sale" value="Sale" <%=(this.Model.PropertyFor != null) ? (this.Model.PropertyFor.ToString().Equals("Sale")) ? "checked" : "" : "" %>/>Sale
                            <input type="radio" class="PropertyFor _rent" value="Rent" <%=(this.Model.PropertyFor != null) ? (this.Model.PropertyFor.ToString().Equals("Rent")) ? "checked" : "" : "" %> " style="
    margin-left: 18px;"/>
                           Rent
                            <%}
                               else
                               { %>
                            <span><input type="radio" class="PropertyFor _sale"  name="PropertyFor" value="Sale" checked /> Sale </span>
                       <span><input type="radio" class="PropertyFor _rent"  name="PropertyFor" value="Rent" style="
    margin-left: 18px;"/> Rent </span>
                       
                            <%} %>
        </td>
            
    </tr>
    <tr>
        <th ><span class="mandate">*</span> Property Classification:</th>
            <td>
            		 
                     <select class="validate[required] chzn-nosearch chz" name="PropertyClsssm" id="PropertyClsssm">
                                         <% if (this.Model != null)
                         { %>
                        <option value="Strata"  <%=(this.Model.PropertyClsssm != null) ? (this.Model.PropertyClsssm.ToString().Equals("Strata")) ? "selected='selected'" : "" : "" %> >Strata</option>
                         <option value="Landed"  <%=(this.Model.PropertyClsssm != null) ? (this.Model.PropertyClsssm.ToString().Equals("Landed")) ? "selected='selected'" : "" : "" %>>Landed</option>
                     <%}
                      else
                      { %>
                           <option value="Strata" >Strata</option>
                         <option value="Landed"  >Landed</option>
                     <%} %>
                     </select>
               
            </td>
            
    </tr>
     <tr>
            <th ><span class="mandate">*</span> Property Type:</th>
            <td>
            	<% Html.RenderPartial("PropertyType", (this.Model == null) ? "" : this.Model.PropertyTypeFID.ToString()); %>
               
            </td>
            
            </tr>
            <!--Begin City-->
   <% 
       string ControllerName = Html.ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString();
       string[] strCityLoSub = new string []{"","",""};
       string[] strCountryCity = new string[] { "", ""};
       if (this.Model != null)
       {
           if (ControllerName == "PropertyInternational" || ControllerName == "ProjectInternational")
           {
               strCountryCity = new string[] { this.Model.CountryFID.ToString(), this.Model.City };
               // 

           }
           else
           {
               if (this.Model.SubAreaFID != null)
               {
                   strCityLoSub = new string[] { this.Model.CityFID.ToString(), this.Model.LocaltionFID.ToString(), this.Model.SubAreaFID.ToString() };
               }
               else
               {
                   strCityLoSub = new string[] { this.Model.CityFID.ToString(), this.Model.LocaltionFID.ToString(), "" };
               }
           }

       }
       if (ControllerName == "PropertyInternational" || ControllerName == "ProjectInternational")
       {
           Html.RenderPartial("CountryCity", strCountryCity);
       }
       else
       {
           Html.RenderPartial("CityLocationSubarea", strCityLoSub);
           %>
            <tr>
        <th>
            <span class="mandate">*</span> <b>Street Name:</b>
        </th>
        <td>
          <% Html.RenderPartial("StreetName", (this.Model== null) ? "" : this.Model.StreetNameFID.ToString()); %>
             </td>
        
    </tr>
           <%
       }
   %>
     <!--End City-->
    
      <tr>
            <th style=" padding-top: 18px;" ><span class="mandate">*</span>Agent in-charge:</th>
            <td style=" padding-top: 18px;">
            	 <% Html.RenderPartial("Agents",(this.Model == null) ? "" : this.Model.MemberFID.ToString()); %>
            	
            	
            </td>
            
   
</table>
     
    </div>
    <div class="right">
    <table border="0" cellpadding="0" cellspacing="0" class="tbl-form" >
        <caption>Property Details</caption>
            <tr>
                <th ><span class="mandate">*</span>Tenure:</th>
                 <td><input type="text" name="Tenure" id="tenure" class="inp-form required" value="<%=(this.Model == null) ? "" : this.Model.Tenure.ToString() %>" />
                <th  ><span class="mandate">*</span>Price:</th>
                
                <td><input type="text" name="Price" id="price" class="validate[required,custom[number]] inp-form "  value="<%=(this.Model == null) ? "" : this.Model.AskingPriceLocal.ToString() %>" />
                	
                </td>
            </tr>
                             <tr>
                
               
            </tr>
            <tr>
                <th  style="padding-left:8px;"><span class="mandate"></span>Price in RMB/sqm:</th>
                <td><input type="text" name="PriceRMB" id="PriceRMB" class="validate[required,custom[number]] inp-form "  value="<%=(this.Model == null) ? "" : this.Model.PriceInRMBPerSQMLocal.ToString() %>" />
                	
                </td>
               <th ><span class="mandate">*</span>Price Unit:</th>
                <td>
                	
                        <select  class="chzn-nosearch chz" id="priceunit" name="Priceunit">
                    
							<option value="RMB">RMB</option>
							
						          
                        </select>
                    
                </td>
                
            </tr>
             
            <tr>
            <th ><span class="mandate">*</span> Bedroom:</th>
            <td>
            	<div class="select_holder">		
                    <% Html.RenderPartial("Bedroom",  (this.Model == null) ? "" : this.Model.Bedroom.ToString() ); %>
                </div>
            </td>
            <th ><span class="mandate">*</span> Bathroom:</th>
            <td>
            	<div class="select_holder">		
                    <% Html.RenderPartial("Bathroom", (this.Model == null) ? "" : this.Model.Bathroom.ToString()); %>
                </div>
            </td>
            </tr>
            
            
              <tr>
                <th ><span class="mandate area_required">*</span> Area Type:</th>
                <td>
                <select class="validate[required]  chzn-nosearch chz" name="AreaType">
                  <option>Please select</option>
                  <% if (this.Model != null)
                         { %>
                        <option value="Floor"  <%=(this.Model.AreaType != null) ? (this.Model.AreaType.ToString().Equals("Floor")) ? "selected='selected'" : "" : "" %> >Floor</option>
                         <option value="Land"  <%=(this.Model.AreaType != null) ? (this.Model.AreaType.ToString().Equals("Land")) ? "selected='selected'" : "" : "" %>>Land</option>
                     <%}
                      else
                      { %>
                          <option value="Floor">Floor</option>
                          <option value="Land">Land</option>
                     <%} %>
                    
                </select>
                </td>
               <th ><span class="mandate area_required">*</span> Size Unit:</th>
                <td>
                <select class="validate[required] chzn-nosearch chz" name="SizeUnit">
                  <option>Please select</option>
                
                  <% if (this.Model != null)
                         { %>
                        <option value="sqm"  <%=(this.Model.AreaUnit != null) ? (this.Model.AreaUnit.ToString().Equals("sqm")) ? "selected='selected'" : "" : "" %> >sqm</option>
                         <option value="sqft"  <%=(this.Model.AreaUnit != null) ? (this.Model.AreaUnit.ToString().Equals("sqft")) ? "selected='selected'" : "" : "" %>>sqft</option>
                     <%}
                      else
                      { %>
                         <option value="sqm">sqm</option>
                         <option value="sqft">sqft</option>
                     <%} %>
                    
                </select>
                
                </td>
            </tr>
            
            <tr>
                <th ><span class="mandate area_required">*</span> Size Area:</th>
                <td>
                <% if (this.Model != null)
                   { %>
                    <%
                        if (this.Model.AreaUnit!=null)
                        {
                          if (this.Model.AreaUnit.Equals("sqm"))
                           { %>
                            <input type="text" name="SizeArea" id="" class="validate[required,custom[number]] inp-form " value="<%=(this.Model == null) ? "" : this.Model.Area_SM.ToString() %>"/>
                        <%}
                            }
                       else
                       {%>
                          <input type="text" name="SizeArea" id="Text1" class="validate[required,custom[number]] inp-form " value="<%=(this.Model == null) ? "" : this.Model.Area_SF.ToString() %>"/>
                 
                	<%}
                   }
                   else
                   {%>
                    <input type="text" name="SizeArea" id="Text2" class="validate[required,custom[number]] inp-form " value=""/>
                 
                   <%} %>
              </td>
               <th ><span class="mandate area_required">*</span> Size Gross Area:</th>
                <td>
                <% if (this.Model != null)
                   { %>
                    <% 
                        if (this.Model.AreaUnit!=null)
                        {
                        
                       if (this.Model.AreaUnit.Equals("sqm"))
                       { %>
                        <input type="text" name="GrossArea" id="GrossArea" class="validate[required,custom[number]] inp-form " value="<%=(this.Model == null) ? "" : this.Model.GrossArea_SM.ToString() %>"/>
                    <%}
                        }
                       else
                       {%>
                          <input type="text" name="GrossArea" id="GrossArea" class="validate[required,custom[number]] inp-form " value="<%=(this.Model == null) ? "" : this.Model.GrossArea_SF.ToString() %>"/>
                 
                	<%}

                   }
                   else
                   { %>
                    <input type="text" name="GrossArea" id="Text3" class="validate[required,custom[number]] inp-form " value=""/>
                   <%} %>
             
               </td>
            </tr>
           
             
             <tr>
                <th ><span class="mandate area_required">*</span> Total Floor:</th>
                <td>
                <input type="text" name="TotalFloor" id="TotalFloor" class="validate[required,custom[number]] inp-form " value="<%=(this.Model == null) ? "" : this.Model.TotalFloor.ToString() %>"/>
                </td>
               <th ><span class="mandate area_required">*</span> Floor Level:</th>
                <td>
                <select class="validate[required]  chzn-nosearch chz" name="FloorLevel">
                  <option>Please select</option>
                    <% if (this.Model != null)
                         { %>
                        <option value="Low"  <%=(this.Model.FloorLevel != null) ? (this.Model.FloorLevel.ToString().Equals("Low")) ? "selected='selected'" : "" : "" %> >Low</option>
                         <option value="Mid"  <%=(this.Model.FloorLevel != null) ? (this.Model.FloorLevel.ToString().Equals("Mid")) ? "selected='selected'" : "" : "" %>>Mid</option>
                     <option value="High"  <%=(this.Model.FloorLevel != null) ? (this.Model.FloorLevel.ToString().Equals("High")) ? "selected='selected'" : "" : "" %>>High</option>
                     <%}
                      else
                      { %>
                         <option value="Low">Low</option>
                     <option value="Mid">Mid</option>
                     <option value="High">High</option>
                     <%} %>
                  
                </select>
                </td>
            </tr>
            <tr>
                <th valign="top" ><span class="mandate">&nbsp;&nbsp;&nbsp;</span>Features:</th>
                <td>
                <div class="scrollbox">
                            <%    
                            if(this.Model!=null){
                                if (this.Model.Features != null)
                                {
                                    char[] delimiters = new char[] { ',' };
                                    string resultf = "'";
                                    string[] feature = this.Model.Features.Split(delimiters);
                                    for (int i = 0; i < feature.Length; i++)
                                    {
                                        resultf += feature[i] + "','";
                                    }
                                    resultf = resultf.Substring(0, resultf.Length - 2);
                                    Html.RenderPartial("Features", resultf);
                                }
                                else
                                {
                                    Html.RenderPartial("Features", "");
                                }

                            }
                            else
                            {
                                Html.RenderPartial("Features", "");
                            }
                                    
                            %>
                	  
	               </div>
                	<a class="check" onclick="$(this).parent().find(':checkbox').attr('checked', true);">Select All</a> / <a class="check" onclick="$(this).parent().find(':checkbox').attr('checked', false);">Unselect All</a>
                </td>
               
                <th valign="top" ><span class="mandate">&nbsp;&nbsp;&nbsp;</span>Facilities:</th>
                <td>
                	<div class="scrollbox">
                	        <%    
                            if(this.Model!=null){
                                if (this.Model.Facilities != null)
                                {
                                    char[] delimiters = new char[] { ',' };
                                    string resultf = "'";
                                    string[] feature = this.Model.Facilities.Split(delimiters);
                                    for (int i = 0; i < feature.Length; i++)
                                    {
                                        resultf += feature[i] + "','";
                                    }
                                    resultf = resultf.Substring(0, resultf.Length - 2);
                                    Html.RenderPartial("Facilities", resultf);
                                }
                                else
                                {
                                    Html.RenderPartial("Facilities", "");
                                }


                            }
                            else
                            {
                                Html.RenderPartial("Facilities", "");
                            }    
                            %>
	                  
	                </div>
                	<a  class="check" onclick="$(this).parent().find(':checkbox').attr('checked', true);">Select All</a> / <a  class="check" onclick="$(this).parent().find(':checkbox').attr('checked', false);">Unselect All</a>
                </td>
               
            </tr>
     </table>
    </div>
    <div style="clear:both">
    <table border="0" cellpadding="0" cellspacing="0" class="tbl-form" style="width: 98%;">
    <tr>
                           
                <th  style="min-width:81px" valign="top"><span class="mandate area_required">*</span> Description:</th>
                <td>
                  <%
                      string languegeID = ViewData["LanguageID"].ToString();
                      if (languegeID == "1")
                      { //english
                     %>
                
                <input id="description_validate" class="validate[required]" style="visibility:hidden;height:0;"/>
               <textarea class="ckeditors" cols="78" id="description" name="Description" rows="10"><%=(this.Model == null) ? "" : this.Model.Description.ToString()%></textarea> <br />
                <input id="descriptioncn_validate" class="" style="visibility:hidden;height:0;"/>
               <input type="hidden" id="descriptioncn" name="DescriptionCN" value="<%=(this.Model == null) ? "" : this.Model.DescriptionCN %>" />               <%}
                     %>
                     <% if (languegeID == "2")
                        { %>
               
                 <input id="descriptioncn_validate" class="validate[required]" style="visibility:hidden;height:0;"/>
               <textarea class="ckeditors" cols="88" id="descriptioncn" name="DescriptionCN" rows="10"><%=(this.Model == null) ? "" : this.Model.DescriptionCN.ToString()%></textarea> 
                <input id="description_validate" class="" style="visibility:hidden;height:0;"/>
                  <input type="hidden" id="description" name="Description" value="<%=(this.Model == null) ? "" : this.Model.Description.ToString() %>" />          
               <%} %>
                </td>
                
            </tr>
                     </tr>
    <tr class="button_ctr">
        
        <td colspan=4 style="text-align: right;">
        <br />
        
            <input type="submit" style="margin-right:0"value="<%=(this.Model != null) ? "Update" : "Save and proceed to Step 2"%>" class="buttons"  onclick="checkForm();"  />
          
        </td>
       
    </tr>
    </table>
    </div>
</div>
